
$(document).ready(function () {
	
	$('.removeFromClipboard').click(function(){
		var ids = ($(this).attr('id'));
		removeFromClipboard(ids);
	});
	
	$('#removeChecked').click(function(){
		var ids = "";
		$(':checked').each(function(){
			ids += $(this).attr('id') + ','
		})
		removeFromClipboard(ids);
	});
	
	$('#removeAll').click(function(){
		var ids = "";
		$('.checkbox').each(function(){
			ids += $(this).attr('id') + ','
		})
		removeFromClipboard(ids);
	});
	
	function removeFromClipboard(ids) {
		$.get(
				"removeFromClipboard", 
				{ "ids": ids},
				function(data) {
					var idsArray = ids.split(',');
					for(i=0;i<idsArray.length;i++){
						$('[name='+idsArray[i]+']').remove();
					}
					alert('document(s) removed from clipboard');
				}
		);
	}
	
	
	
	
});